In software development, a breakpoint is typically placed in a program to find out why the program is not operating as expected (i.e., to find bugs). In some debuggers, when the breakpoint is encountered, execution of the program pauses and the user can inspect the values of various registers, memory locations, and so on. An instruction breakpoint can be used to interrupt a running program immediately before the execution of a user-specified instruction. A conditional breakpoint can be used to pause a program when a user-supplied condition is encountered. A data breakpoint or watchpoint can be used to interrupt a running program when a specified location in memory is read or written to. In languages with compacting garbage collectors, a data breakpoint typically does not work because data is moved by the garbage collector during the garbage collection cycle.
In computer science, garbage collection (GC) is a type of automatic memory management in which the garbage collector periodically reclaims memory occupied by data that is no longer needed by the program. In manual (as opposed to automatic) memory management, a programmer explicitly specifies what locations in memory are de-allocated. A traditional garbage collector marks all the reachable locations in an area of memory and reclaims for re-use all the other locations in the area of memory.
A compacting garbage collector moves the contents of all the reachable locations together to make memory usage more efficient. Use of a compacting garbage collector enables more efficient use of memory because as the program runs, memory becomes fragmented. Eventually the useable portions of memory become so small that they can no longer be used. The compacting garbage collector moves the data that is needed so that the area of memory used is more compact. Thus, larger portions of free space result when garbage collected areas are reclaimed. That is, the data that is still in use can be re-written to an area of memory so that a larger contiguous area of memory can be reclaimed. One effect of this approach is that the address where a certain piece of data is stored can change during the execution of the program as a result of garbage collection. This makes the traditional use of data breakpoints ineffective because the breakpoint can point to an area of memory that was reclaimed by the garbage collector and may even have been re-used by the program so that the breakpoint no longer points to the data it pointed to before the garbage collector ran.